//
//  YRJShowCenterWebViewController.m
//  YanRenjie
//
//  Created by dllo on 15/11/2.
//  Copyright (c) 2015年 yanrenjie. All rights reserved.
//

#import "YRJShowCenterWebViewController.h"
#import "YRJTripHeader.h"

@interface YRJShowCenterWebViewController ()<UIWebViewDelegate>
@property(nonatomic, retain)MBProgressHUD *hud;
@end

@implementation YRJShowCenterWebViewController
{
    // 风火轮
    UIActivityIndicatorView *acView;
}


- (void)dealloc {
    [_product_id release];
    
    [super dealloc];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    self.hud.labelText = @"Loading...";
    
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    [self.view addSubview:webView];
    webView.delegate = self;
    webView.scalesPageToFit = YES;
    [webView release];
    
    acView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, (32.0 / 375) * WIDTH, (32.0 / 375) * WIDTH)];
    acView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
    acView.center = self.view.center;
    [acView release];
    
    NSString *strURL = [NSString stringWithFormat:@"%@%@%@", @"http://web.breadtrip.com/hunter/product/", self.product_id, @"/"];
    NSURL *url = [NSURL URLWithString:strURL];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webView loadRequest:request];
    
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    self.hud.hidden = YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
